{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "9cb531de9af24cd091122bb96ae37e5f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, camera=[4.5, 4.5, 4.5, 0.0, 0.0, 0.0, 1.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import vtk\n",
    "from vtkplotter import *\n",
    "\n",
    "# Create a volume with tensors\n",
    "pl = vtk.vtkPointLoad()\n",
    "pl.SetLoadValue(100)\n",
    "pl.SetSampleDimensions(6,6,6)\n",
    "pl.ComputeEffectiveStressOn()\n",
    "pl.SetModelBounds(-10,10,-10,10,-10,10)\n",
    "pl.Update()\n",
    "vol = Volume(pl.GetOutput(), mode=1)\n",
    "\n",
    "# Extract a slice of the volume data at index 3\n",
    "zsl = vol.zSlice(3)\n",
    "\n",
    "# Generate tensor ellipsoids\n",
    "# tens = Tensors(vol, source='ellipsoid', scale=10)\n",
    "tens = Tensors(zsl, source='ellipsoid', scale=20)\n",
    "\n",
    "#show([vol, [tens, zsl]], N=2, axes=1, viewup='z')\n",
    "show(vol, tens, zsl)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
